import java.util.Stack;
//用两个栈实现一个队列
public class Solution {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();

    public void push(int node) {
        stack1.push(node);
    }
    public int pop() {
        if(stack2.isEmpty()) {
            while(!stack1.isEmpty()) {
                int a = stack1.peek();
                stack2.push(a);
                stack1.pop();
            }
            int b = stack2.peek();
            stack2.pop();
            return b;
        } else {
            int x = stack2.peek();
            stack2.pop();
            return x;
        }
    }
}

